package player_model

//go:generate msgp

//msgp:tuple PlayerModelExtend
type PlayerModelExtend struct {
	Key  string `json:"key" msg:"key"`
	Gold int    `json:"gold" msg:"gold"`
	Own  bool   `json:"own" msg:"own"`
	Use  bool   `json:"use" msg:"use"`
}

func NewPlayerModelExtend(model *PlayerModel, userModel *PlayerUserModel) *PlayerModelExtend {
	extend := &PlayerModelExtend{
		Key:  model.Key,
		Gold: model.Gold,
		Own:  false,
		Use:  false,
	}
	if userModel != nil {
		extend.Own = true
		if userModel.Use {
			extend.Use = true
		}
	}

	return extend
}
